<template>
  <div>
    <div class="lov">
      <div class="lovtop" @click="$router.push('/userInfo')">
        <img src="../../assets/Search/46.png" alt="" />
        <span>我的喜欢</span>
      </div>
      <div class="lovcent">
        <ul>
          <li v-for="(item, index) in title" :key="index" @click="play()">
            {{ item.songs[0].name }}
            <div class="centtu">
              <img src="../../assets/Search/12.png" alt="" />
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getlands, getlandxiangq } from "../../api/land";
export default {
  data() {
    return {
      lis: [],
      lisid: "",
      title: [],
    };
  },
  methods: {
    Fungetlands() {
      getlands({ uid: this.lisid }).then((data) => {
        this.lis = data.ids;
        // console.log(this.lis);
      });
    },

    Fungetlandsdf() {
      for (let i = 0; i < this.lis.length; i++) {
        if (i > 30) {
          return;
        } else {
          getlandxiangq({ ids: this.lis[i] }).then((data) => {
            this.title.push(data);
            // console.log(this.title);
          });
        }
      }
    },

    play() {
      console.log(111);
      // this.$parent.getPlayerId(id);
    },
  },
  created() {
    this.lisid = this.$route.query.id;
    this.Fungetlands();
    setTimeout(() => {
      this.Fungetlandsdf();
    }, 400);
  },
};
</script>

<style lang="less">
.lov {
  width: 100%;
  .lovtop {
    width: 100%;
    height: 40px;
    background: #ee534f;
    box-sizing: border-box;
    position: relative;
    img {
      width: 30px;
      height: 30px;
      display: inline-block;
      position: absolute;
      top: 4px;
      left: 5px;
    }
    span {
      position: absolute;
      color: white;
      top: 7px;
      left: 40%;
    }
  }
}
.lovcent {
  width: 100%;
  box-sizing: border-box;
  padding-top: 5px;
  padding-left: 7px;
  padding-right: 7px;
  ul {
    width: 100%;
    box-sizing: border-box;
    li {
      position: relative;
      width: 100%;
      height: 45px;
      box-sizing: border-box;
      display: flex;
      justify-content: end;
      align-items: center;
      border-bottom: 1px solid #ee534f;
    }
    .centtu {
      position: absolute;
      top: 10px;
      right: 10px;
      img {
        width: 25px;
        height: 25px;
      }
    }
  }
}
</style>